module.exports = (app) => {
    const express = require('express');
    const router = express.Router();
    const System = require('../model/systemModel')

    // 获取
    router.get('/getSystemInfo',async (q,s)=>{
        let system = await System.find();
        s.send(system);
    })
    router.post("/add",async (q,s)=>{
        const model = await System.create(q.body);
        s.send(model);
    })
    // 修改
    router.post('/updateSystemInfo',async (q,s)=>{
        let system = await System.findOne({_id:"607468e10a9acf0f58cbba88"});
        system.help = q.body.help == undefined ? system.help : q.body.help;
        system.feedback = q.body.feedback == undefined ? system.feedback : q.body.feedback;
        system.swiper_img = q.body.swiper_img == undefined ? system.swiper_img : q.body.swiper_img;
        system.version = q.body.version == undefined ? system.version : q.body.version;
       await system.save();
        s.send(system);
    })

    router.get('/base',async (q,s)=>{

    })
    app.use('/system',router);
}